//
//  SelfDiagnosisViewModel.h
//  MobileChecker
//
//  Created by Lymons on 15-1-7.
//  Copyright (c) 2015年 Lymons. All rights reserved.
//

#import <ReactiveCocoa/ReactiveCocoa.h>
#import "RVMViewModel.h"
#import "BaseSelfDiagnosisService.h"
#import "CheckResultUserDefaults.h"
#import <AVFoundation/AVFoundation.h>

typedef void (^OkNgBlock)(BOOL result);

@interface SelfDiagnosisViewModel : RVMViewModel
{
    NSString *headerInitialString;
    NSString *headerCompletedString;
}

@property (strong, nonatomic) RACCommand *executeCheck;
@property (strong, nonatomic) RACCommand *resultOK;
@property (strong, nonatomic) RACCommand *resultNG;
@property (assign, nonatomic) BOOL checkCompleted;
@property (strong, nonatomic) NSString *headerString;
@property (assign, nonatomic) BOOL enableCheck;
@property (assign, nonatomic) NSUInteger leftSeconds;
@property (assign, nonatomic) NSUInteger totalSeconds;

// for public
- (instancetype)initWithServices:(id<SelfDiagnosisService>)services;
- (RACCommand *)makeCommandWithBlock:(OkNgBlock)okngBlock simple:(BOOL)okng;
- (RACCommand *)makeCommandWithBlock:(OkNgBlock)okngBlock detail:(DiagnosisCheckResult)result;

- (void)executeTheCheckCommand:(id)input;
- (void)completeTheCheckCommand;

// for subclass
- (void)initialize;
- (void)setupSignals;
- (void)checkDidCompleted;
- (void)resultDidReceived:(DiagnosisCheckResult)result;

@end

@interface DiagnosisVibrationViewModel : SelfDiagnosisViewModel

@end

@interface DiagnosisRecordViewModel : SelfDiagnosisViewModel

@property (strong, nonatomic) NSString *volumeDbString;

@end

@interface DiagnosisSoundViewModel : SelfDiagnosisViewModel

@property (nonatomic, strong) NSString *toastMessage;

- (instancetype)initWithType:(SoundDiagnosisServiceType)type;
- (RACSignal *)requestRecordPermission;

@end

@interface DiagnosisTouchViewModel : SelfDiagnosisViewModel

@end

@interface DiagnosisScreenViewModel : SelfDiagnosisViewModel

@end


